Declarations of variables
Pascal C/C++
wvar
w i: integer;
w r: real;
w b: boolean;
w c: char;
w j, k, l: integer;
w int i;
w float r;
w int b;
w char c;
w int j, k, l;
w
w unsigned int i;
w unsigned char c;
In C (but not C++), an integer constant declared this way may NOT be used to specify the size of an array in most cases.
New ANSI Standard C++
bool b;
1.C does not use a word like var to introduce variable declarations – it just declares them.
2.C does not have a separate type for boolean values. Int is used, with 0=false and 1=true. The new ANSI C++ standard calls for a built in type bool with values false and true, but not all C++ compilers implement it yet.
3.In addition to the scalar types shown above, C has
short int (may be abbreviated short)
long int (may be abbreviated long)
double (double-precision real)
4. Any integer type (including char) may be prefixed by unsigned – e.g.
unsigned int i;